﻿namespace JustinAngel.MindwaveSensor.WP8.Common
{
    public static class IntHelper
    {
        public static int GetUnsignedInt24ValueFrom3Bytes(byte[] usefulDataPacket, int beginInclusiveIndex)
        {
            // http://www.java2s.com/Code/CSharp/Data-Types/ReadInt24frombytearray.htm
            return (usefulDataPacket[beginInclusiveIndex] << 16)
                + (usefulDataPacket[beginInclusiveIndex + 1] << 8)
                + (usefulDataPacket[beginInclusiveIndex + 2]);
        }
    }
}
